<<usegrids>>
<div id="staticcontenttabs">
<ul>
<<section name="staticcontenttab" loop="$staticcontenttabtypes">>
    <li><a href="#staticcontenttabs-<<$smarty.section.staticcontenttab.iteration>>"><<$staticcontenttabtypes[staticcontenttab].title>></a></li>
<</section>>
</ul>
<<section name="tab" loop="$staticcontenttabtypes">>
    <div id="staticcontenttabs-<<$smarty.section.tab.iteration>>">
<<$staticcontenttabtypes[tab].content>>
    </div>
<</section>>
</div>

<button onclick="saveStaticContent()">Save contents</button>

<script>
function saveStaticContent() {
    callAdminService("static_content", "savecontent", {
        aboutus    : jQuery("textarea[name='aboutus']").html(),
        contactus  : jQuery("textarea[name='contactus']").html(),
        termsofuse : jQuery("textarea[name='termsofuse']").html(),
        chambers   : jQuery("textarea[name='chambers']").html(),
        visithungary : jQuery("textarea[name='visithungary']").html(),
        associations : jQuery("textarea[name='associations']").html(),
        usefullinks  : jQuery("textarea[name='usefullinks']").html(),
        mediaoffer   : jQuery("textarea[name='mediaoffer']").html(),
        businessinhungary : jQuery("textarea[name='businessinhungary']").html()
    }, {
        success : function(result) {
            displayMessage("info", "Content successfully saved!");
        }
    });
}

jQuery("div#staticcontenttabs").tabs({
    select: function(event, ui) {
        switch (ui.index) {
<<section name="tab" loop="$staticcontenttabtypes">>
            case <<$smarty.section.tab.iteration-1>>: {
                if (typeof(window["on<<$staticcontenttabtypes[tab].type>>Open"]) == "function") {
                    on<<$staticcontenttabtypes[tab].type>>Open();
                }
            }
<</section>>
        }
    }
});
if (typeof(window["on<<$staticcontenttabtypes[0].type>>Open"]) == "function") {
    on<<$staticcontenttabtypes[0].type>>Open();
}

function sendTeststaticcontent() {
    callAdminService("staticcontent", "sendtestmail", {
        email : jQuery("input[name='email']").val(),
        businessleads : (jQuery("input[type='checkbox'][name='leads']:checked").size() > 0 ? true : false),
        services : (jQuery("input[type='checkbox'][name='services']:checked").size() > 0 ? true : false),
        requests : (jQuery("input[type='checkbox'][name='requests']:checked").size() > 0 ? true : false),
        articles : jQuery("textarea[name='articles']").html(),
        briefings : jQuery("textarea[name='briefings']").html(),
        attention : jQuery("textarea[name='attention']").html(),
        successstories : jQuery("textarea[name='successstories']").html()
    }, {
        success : function(result) {
        }
    });
}

function sendstaticcontents() {
    var target = jQuery("select[name='target'] option:selected").val();
    if (target == "0") {
        alert("Please select a staticcontent target in the dropdown list");
        return;
    }
    callAdminService("staticcontent", "sendstaticcontent", {
    }, {
        success : function(result) {
            displayMessage("info", "staticcontents have been successfully sent");
        }
    });
}

createGrids();
createEditors();

</script>
